package com.qingcloud.adminbackend.entity.aline;


import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 传感器监测因子校准查询DTO对象
 */
@Data
public class AlinePageDTO implements Serializable {

    @ApiModelProperty(value = "用户编号", hidden = true)
    private String userId;

    @ApiModelProperty(value = "是否是管理员", hidden = true)
    private Boolean isAdmin;

    @ApiModelProperty(value = "校准历史标识：0实时，1历史")
    private Integer hisFlag;

    @ApiModelProperty(value = "设备编号", example = "1190100001")
    private String equipmentId;

    @ApiModelProperty(value = "设备编号列表", hidden = true)
    private List<String> equipmentIdList;

    @ApiModelProperty(value = "客户列表")
    private List<String> orgList;

    @ApiModelProperty(value = "订单列表")
    private List<String> orderIdList;

    @ApiModelProperty(value = "是否设备池查询: 0否 1是", example = "0")
    private Integer equipmentPool;

    @ApiModelProperty(value = "监测因子")
    private List<String> factorIdList;

    @ApiModelProperty(value = "操作结果")
    private List<Integer> operateStatusList;

    @ApiModelProperty(value = "查询开始时间", example = "2019-04-10 00:00:00")
    private String startTime;

    @ApiModelProperty(value = "查询结束时间", example = "2019-04-19 12:00:00")
    private String endTime;

    @ApiModelProperty(value = "起始页(从1开始)", example = "1")
    private Integer currentPage;

    @ApiModelProperty(value = "每页显示记录数)", example = "10")
    private Integer perPage;

    @ApiModelProperty(value = "分页查询游标位置", hidden = true)
    private Integer offset;

    public Integer getOffset() {
        if(currentPage==null || perPage==null){
            return null;
        } else {
            currentPage = currentPage < 1 ? 1 : currentPage;
            return (currentPage-1) * perPage;
        }
    }
}
